<?php

namespace App\Http\Requests\Admin\AdminUser;
use App\Http\Requests\Request;

class CreateRequest extends Request{
    public function authorize(){
        return true;
    }
    public function rules(){
        return [
            'name' => 'required|alpha_dash|unique:admin_users,name',
            'email' => 'required|email',
            'password' => 'required|between:6,20|confirmed',
        ];
    }
    public function messages(){
        return [
            'name.required' => '用户名称必须填写',
            'name.alpha_dash' => '用户可允许字母、数字、破折号（-）以及底线（_）',
            'name.unique' => '该用户名称已存在',
            'email.required' => '邮箱必须填写',
            'email.email' => '邮箱非法',
            'password.required' => '密码必须填写',
            'password.between' => '密码必须在6-20位之间！',
            'password.confirmed'=>'密码和确认密码不一致！',
        ];
    }
}
